package cn.steel.mapper;

import cn.steel.domain.entity.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ProductMapper {
    List<Product> findProductsPaginated(
            @Param("search") String search,
            @Param("supplierName") String supplierName,
            @Param("categoryId") Long categoryId,
            @Param("shippingRegion") String shippingRegion,
            @Param("supplierId") Long supplierId,
            @Param("status") Integer status);
    int countProducts(
            @Param("search") String search,
            @Param("supplierName") String supplierName,
            @Param("categoryId") Long categoryId,
            @Param("shippingRegion") String shippingRegion,
            @Param("supplierId") Long supplierId,
            @Param("status") Integer status);
    Product findProductById(Long id);
    void insertProduct(Product product);
    void updateProduct(Product product);
    void deleteProduct(Long id);
    // 更新商品表的库存
    int updateProductInventory(@Param("productId") Long productId, @Param("quantity") Integer quantity);

}